<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>

<div id="rightPan">
	<div id="rightbodyPan">
		<div align="center"><p style=" font-size: 24px; padding: 10px 0 5px 0;" >สินค้า ประเภทอาหาร</p></div>
		<div id="headerTab">
			<a style="width: 130px;" href="<s:url action="food_get" namespace="/product"/>">เรียกดูข้อมูลทั้งหมด</a>
			<a style="width: 130px;" href="<s:url action="food_toSearch" namespace="/product"/>">ค้นหา/เรียกดู ข้อมูล</a>
			<a style="width: 70px;" id="clicked">เพิ่มข้อมูล</a>
		</div>
		
		<script type="text/javascript">
			function add1(){
				document.getElementById( 'food_add1' ).submit();
			}
			
			function selectBrand( value ){
				if ( value != -1 ){
					document.getElementById("newFoodBrand").disabled = true;
					document.getElementById("newFoodBrand").value = "";
				}
				else{
					document.getElementById("newFoodBrand").disabled = false;
				}
			}
			
			function selectTaste( value ){
				if ( value != "-1" ){
					document.getElementById("newTaste").disabled = true;
					document.getElementById("newTaste").value = "";
				}
				else{
					document.getElementById("newTaste").disabled = false;
				}
			}
			
			function selectBreed(value){
				if ( value != -1 ){
					document.getElementById("selectSize").disabled = true;
					document.getElementById("selectSize").value = -1;
				}
				else{
					document.getElementById("selectSize").disabled = false;
				}
			}
			
			function onSelectSize(value){
				if ( value != "-1" ){
					document.getElementById("breedNameList").disabled = true;
					document.getElementById("breedNameList").value = -1;
				}
				else{
					document.getElementById("breedNameList").disabled = false;
				}
			}
			
		</script>
		
		<s:form id="food_add1" action="food_add1" theme="simple">
			<table>
				<tr>
					<td style="padding-top: 20px; " id="slabel">ชื่ออาหาร:<span>*</span></td>
					<td style="padding-top: 20px;"><s:textfield name="food.foodName" size="40"/></td>
				</tr>
				<tr>
					<td id="slabel">ยี่ห้อ:<span>*</span></td>
					<td><s:select list="selectBrand" key="food.foodBrand" headerKey="-1" headerValue=""
					 onchange="selectBrand(this.value)"/>
					<s:textfield name="food.newFoodBrand" size="25" id="newFoodBrand"/></td>
				</tr>
				<tr>
					<td id="slabel">รายละเอียด:<span>*</span></td>
					<td><s:textarea style="width: 380px; height: 80px;" key="food.description"/></td>
				</tr>
				<tr>
					<td id="slabel">ประเภท:<span>*</span></td>
					<td><s:select list="selectType" key="food.foodType" headerKey="-1" headerValue=""/></td>
				</tr>
				<tr>
					<td id="slabel">พันธุ์ที่เหมาะสม:</td>
					<td><s:select list="breedNameList" key="food.dogBreedId" headerKey="-1" headerValue=""
					 id="breedNameList" onchange="selectBreed(this.value)"/></td>
				</tr>
				<tr>
					<td id="slabel">ขนาดที่เหมาะสม:</td>
					<td><s:select list="selectSize" key="food.dogSize" headerKey="-1" headerValue=""
					 id="selectSize" onchange="onSelectSize(this.value)"/></td>
				</tr>
				<tr>
					<td id="slabel">วัยที่เหมาะสม:<span>*</span></td>
					<td><s:select list="selectLifeSpan" key="food.dogAge" headerKey="-1" headerValue=""/></td>
				<tr>
					<td id="slabel">รสชาติ:</td>
					<td><s:select list="tastes" key="food.taste" headerKey="-1" headerValue=""
					 onchange="selectTaste(this.value)"/>
					<s:textfield name="food.newTaste" size="15" id="newTaste"/></td>
				</tr>
				<tr>
					<td id="slabel">ปริมาณแคลอรี่:<span>*</span></td>
					<td><s:textfield name="food.kilocalorie" size="7" style=" text-align:right;"/>
					<s:select list="calType" key="food.calType" headerKey="-1" headerValue=""/></td>
				</tr>
			</table>
			
			<div align="center" style=" padding-top: 10px;">
			<input onclick="add1()" type="button" value="เพิ่มข้อมูลทั่วไป >>" id="button" style="width:130px;"></input>
			</div>
		</s:form>
		
	</div>
</div>